import 'package:get/get.dart';
import 'package:largefriends/entity/entities/lf_bool_entity.dart';
import 'package:largefriends/net/lf_api_url.dart';
import 'package:largefriends/net/lf_dio_util.dart';
import 'package:largefriends/res/strings/lf_strings.dart';
import 'package:largefriends/service/lf_auth_service.dart';
import 'package:largefriends/widgets/dialog_action_tip.dart';

checkHidden(Function callback) {
  LfAuthService authService = Get.find();
  if (authService.currentAccount?.isHiddenItemOpen() == true) {
    showActionTips(
      tips: strProfileIsHiddenTip.tr,
      actionButtonTip: strUnhide.tr,
      action: () {
        LfDio().post<LfBoolEntity>(
            url: apiSetPrivacy,
            params: {'type': "hidden_all", "status": 0}).then((value) {
          authService.currentAccount!
            ..hidden = 0
            ..hiddenGender = 0;
          authService.setUserEntity(authService.currentAccount);
        }, onError: (error) {});
        callback.call();
      },
      showCancel: true,
      dismissible: false,
    );
  } else {
    callback.call();
  }
}
